
clear all


* Paths

cd "/Users/rpowers/Library/CloudStorage/Dropbox/CPP Politicized Trade/Replication Archive/For Upload/"

adopath + "/Users/rpowers/Library/CloudStorage/Dropbox/CPP Politicized Trade/Replication Archive/For Upload/med ado/"




use mturk_med_df.dta
set seed  4321
medci bin_support, t(democracy) ms(bin_avg_sec bin_avg_econ bin_avg_inst) xs(i.democracy sim_culture high_income small_econ ally Female age partyID_recode income i.edu) reps(1000)

mat fx_mturk = r(paths)
 
clear
svmat fx_mturk
xpose, varname clear
rename v1 est
rename v2 lo
rename v3 hi
replace _varname = "sec" if _varname == "fx_mturk1" 
replace _varname = "econ" if _varname == "fx_mturk2" 
replace _varname = "inst" if _varname == "fx_mturk3" 
replace _varname = "oth" if _varname == "fx_mturk4" 


gen sample = "mTurk"

save mTurk_mediation.dta, replace

clear 
use lucid_med_df.dta
set seed  4321
medci bin_support, t(democracy) ms(bin_avg_sec bin_avg_econ bin_avg_inst) xs(i.democracy sim_culture high_income small_econ ally Female age partyID hhi i.edu) reps(1000)

mat fx_lucid = r(paths)
clear
svmat fx_lucid

xpose, varname clear
replace _varname = "sec" if _varname == "fx_lucid1" 
replace _varname = "econ" if _varname == "fx_lucid2" 
replace _varname = "inst" if _varname == "fx_lucid3" 
replace _varname = "oth" if _varname == "fx_lucid4" 
rename v1 est
rename v2 lo
rename v3 hi
gen sample = "Lucid"
append using mTurk_mediation


replace _varname = "Security concerns" if _varname == "sec" 
replace _varname = "Economic concerns" if _varname =="econ" 
replace _varname = "Institutional concerns" if _varname =="inst" 
replace _varname = "Other concerns" if _varname == "oth" 
rename _varname name
saveold mediation_results.dta, replace ver(12)


rm  mTurk_mediation.dta

